<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="STM32CubeMX GPS GPS数据">
    <meta name="description" content="本篇详细的记录了如何使用STM32CubeMX配置STM32L431RCT6的 USART 外设，接收 GPS 模块的数据并解析。


1. 准备工作硬件准备
开发板首先需要准备一个开发板，这里我准备的是STM32L4的开发板（BearPi">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <title>STM32CubeMX-23 | 使用USART接收GPS数据并解析(L80-R) | Mculover666</title>
    <link rel="icon" type="image/png" href="/favicon.png">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">

    <script src="/libs/jquery/jquery.min.js"></script>
    
<meta name="generator" content="Hexo 4.2.1"><link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css"></head>


<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">Mculover666</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="" class="waves-effect waves-light">

      
      <i class="fas fa-list" style="zoom: 0.6;"></i>
      
      <span>系列教程</span>
      <i class="fas fa-chevron-down" aria-hidden="true" style="zoom: 0.6;"></i>
    </a>
    <ul class="sub-nav menus_item_child ">
      
      <li>
        <a href="/posts/578764034/">
          
          <span>STM32CubeMX</span>
        </a>
      </li>
      
    </ul>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="https://blog.csdn.net/Mculover666" target="_blank" rel="noopener" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>CSDN</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/download" class="waves-effect waves-light">
      
      <i class="fas fa-download" style="zoom: 0.6;"></i>
      
      <span>资源下载</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>

<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">Mculover666</div>
        <div class="logo-desc">
            
            嵌入式 STM32 物联网领域的教程及精彩内容分享
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="javascript:;">
			
				<i class="fa-fw fas fa-list"></i>
			
			系列教程
			<span class="m-icon"><i class="fas fa-chevron-right"></i></span>
		</a>
            <ul  style="background:  ;" >
              
                <li>   
				
                  <a href="/posts/578764034/ " style="margin-left:75px";>
				  
		          <span>STM32CubeMX</span>
                  </a>
                </li>
               
            </ul>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="https://blog.csdn.net/Mculover666" target="_blank" rel="noopener" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			CSDN
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/download" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-download"></i>
			
			资源下载
		</a>
          
        </li>
        
        
        <li><div class="divider"></div></li>
        <li>
            <a href="https://github.com/Mculover666" class="waves-effect waves-light" target="_blank">
                <i class="fab fa-github-square fa-fw"></i>Fork Me
            </a>
        </li>
        
    </ul>
</div>

        </div>

        
            <style>
    .nav-transparent .github-corner {
        display: none !important;
    }

    .github-corner {
        position: absolute;
        z-index: 10;
        top: 0;
        right: 0;
        border: 0;
        transform: scale(1.1);
    }

    .github-corner svg {
        color: #0f9d58;
        fill: #fff;
        height: 64px;
        width: 64px;
    }

    .github-corner:hover .octo-arm {
        animation: a 0.56s ease-in-out;
    }

    .github-corner .octo-arm {
        animation: none;
    }

    @keyframes a {
        0%,
        to {
            transform: rotate(0);
        }
        20%,
        60% {
            transform: rotate(-25deg);
        }
        40%,
        80% {
            transform: rotate(10deg);
        }
    }
</style>

<a href="https://github.com/Mculover666" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
   data-tooltip="Fork Me" data-position="left" data-delay="50">
    <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
              fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
              fill="currentColor" class="octo-body"></path>
    </svg>
</a>
        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/23.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">STM32CubeMX-23 | 使用USART接收GPS数据并解析(L80-R)</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        margin: 35px 0 15px 0;
        padding-left: 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        height: calc(100vh - 250px);
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #toc-content .is-active-link::before {
        background-color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/STM32CubeMX/">
                                <span class="chip bg-color">STM32CubeMX</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/categories/STM32CubeMX/" class="post-category">
                                STM32CubeMX
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2019-08-13
                </div>
                

                

                

                

                
                    <div id="busuanzi_container_page_pv" class="info-break-policy">
                        <i class="far fa-eye fa-fw"></i>阅读次数:&nbsp;&nbsp;
                        <span id="busuanzi_value_page_pv"></span>
                    </div>
				
            </div>

        </div>
        <hr class="clearfix">
        <div class="card-content article-card-content">
            <div id="articleContent">
                <p>本篇详细的记录了如何使用STM32CubeMX配置STM32L431RCT6的 USART 外设，接收 GPS 模块的数据并解析。</p>
<a id="more"></a>

<h1 id="1-准备工作"><a href="#1-准备工作" class="headerlink" title="1. 准备工作"></a>1. 准备工作</h1><h2 id="硬件准备"><a href="#硬件准备" class="headerlink" title="硬件准备"></a>硬件准备</h2><ul>
<li>开发板<br>首先需要准备一个开发板，这里我准备的是STM32L4的开发板（BearPi）：</li>
</ul>
<p><img src="http://mculover666.cn/image/20190806/9uiPTi5odYSj.png?imageslim" alt=""></p>
<ul>
<li>GPS模块（L80-R）<br>Quectel L80-R 是一款集成了贴片天线的紧凑型GPS模块，非常适合在物联网设备中使用，尤其适合在车载、个人跟踪、工业PDA及各种手持式设备中使用：</li>
</ul>
<p><img src="http://mculover666.cn/blog/20191031/STXCYEk4YMpO.png?imageslim" alt=""></p>
<p>GPS模块的原理图如下：</p>
<p><img src="http://mculover666.cn/blog/20191031/XiH6ImpbeBCA.png?imageslim" alt=""></p>
<h2 id="软件准备"><a href="#软件准备" class="headerlink" title="软件准备"></a>软件准备</h2><ul>
<li>需要安装好Keil - MDK及芯片对应的包，以便编译和下载生成的代码；</li>
<li>准备一个串口调试助手，这里我使用的是<code>Serial Port Utility</code>；</li>
</ul>
<blockquote>
<p>Keil MDK和串口助手Serial Port Utility 的安装包都可以<strong>在文末关注公众号获取</strong>，回复关键字获取相应的安装包：</p>
</blockquote>
<p><img src="http://mculover666.cn/image/20190814/gubaOwmETp1w.png?imageslim" alt=""></p>
<h1 id="2-生成MDK工程"><a href="#2-生成MDK工程" class="headerlink" title="2.生成MDK工程"></a>2.生成MDK工程</h1><h2 id="选择芯片型号"><a href="#选择芯片型号" class="headerlink" title="选择芯片型号"></a>选择芯片型号</h2><p>打开STM32CubeMX，打开MCU选择器：<br><img src="http://mculover666.cn/image/20190806/gBP6glmUSH80.png?imageslim" alt=""></p>
<p>搜索并选中芯片<code>STM32L431RCT6</code>:<br><img src="http://mculover666.cn/image/20190806/gnyHwdl53uVD.png?imageslim" alt=""></p>
<h2 id="配置时钟源"><a href="#配置时钟源" class="headerlink" title="配置时钟源"></a>配置时钟源</h2><ul>
<li>如果选择使用外部高速时钟（HSE），则需要在System Core中配置RCC；</li>
<li>如果使用默认内部时钟（HSI），这一步可以略过；</li>
</ul>
<p>这里我都使用外部时钟：<br><img src="http://mculover666.cn/image/20190806/k593lGGb5tlW.png?imageslim" alt=""></p>
<h2 id="配置GPS使能引脚"><a href="#配置GPS使能引脚" class="headerlink" title="配置GPS使能引脚"></a>配置GPS使能引脚</h2><p>小熊派开发板设置了一个使能引脚，用于控制GPS模块的电源：</p>
<p><img src="http://mculover666.cn/blog/20191031/Lsu2Fdp80u0U.png?imageslim" alt=""></p>
<p>所以要配置这个使能引脚（PC9）：</p>
<p><img src="http://mculover666.cn/blog/20191031/HOdzkKcfGbgs.png?imageslim" alt=""></p>
<h2 id="配置调试串口"><a href="#配置调试串口" class="headerlink" title="配置调试串口"></a>配置调试串口</h2><p>小熊派开发板板载ST-Link并且虚拟了一个串口，原理图如下：</p>
<p><img src="http://mculover666.cn/image/20190814/IwyXONVefPx9.png?imageslim" alt=""></p>
<p>这里我将开关拨到<code>AT-MCU</code>模式，使PC的串口与USART1之间连接。</p>
<p>接下来开始配置<code>USART1</code>：</p>
<p><img src="http://mculover666.cn/image/20190814/nLMRMYtmzghl.png?imageslim" alt=""></p>
<h2 id="配置GPS模块通信串口"><a href="#配置GPS模块通信串口" class="headerlink" title="配置GPS模块通信串口"></a>配置GPS模块通信串口</h2><p>GPS模块与USART3串口相连接，接下来开始配置USART3，波特率9600：</p>
<p><img src="http://mculover666.cn/blog/20191031/1b5EMIvH7vLK.png?imageslim" alt=""></p>
<h2 id="NVIC配置"><a href="#NVIC配置" class="headerlink" title="NVIC配置"></a>NVIC配置</h2><p>配置 USART3 的中断优先级，首先选择一个中断优先级分组：</p>
<p><img src="http://mculover666.cn/blog/20191031/8x88G2Sa6bLo.png?imageslim" alt=""></p>
<p>然后设置优先级：</p>
<p><img src="http://mculover666.cn/blog/20191031/M8cHst9XdVHJ.png?imageslim" alt=""></p>
<h2 id="配置时钟树"><a href="#配置时钟树" class="headerlink" title="配置时钟树"></a>配置时钟树</h2><p>STM32L4的最高主频到80M，所以配置PLL，最后使<code>HCLK = 80Mhz</code>即可：<br><img src="http://mculover666.cn/image/20190806/1TQg7frjRpVr.png?imageslim" alt=""></p>
<p><img src="http://mculover666.cn/image/20190808/EVKCwrQNEWcl.png?imageslim" alt=""></p>
<p><img src="http://mculover666.cn/image/20190806/Dje8nuTMdpQY.png?imageslim" alt=""></p>
<h2 id="生成工程设置"><a href="#生成工程设置" class="headerlink" title="生成工程设置"></a>生成工程设置</h2><p><img src="http://mculover666.cn/blog/20191031/f6F3UpBjP0kM.png?imageslim" alt=""></p>
<h2 id="代码生成设置"><a href="#代码生成设置" class="headerlink" title="代码生成设置"></a>代码生成设置</h2><p>最后设置生成独立的初始化文件：</p>
<p><img src="http://mculover666.cn/image/20190806/T6WvSK6Dfpts.png?imageslim" alt=""></p>
<h2 id="生成代码"><a href="#生成代码" class="headerlink" title="生成代码"></a>生成代码</h2><p>点击<code>GENERATE CODE</code>即可生成MDK-V5工程：</p>
<p><img src="http://mculover666.cn/image/20190806/s0jGhLBWW6Cm.png?imageslim" alt=""></p>
<h1 id="3-在MDK中编写、编译、下载用户代码"><a href="#3-在MDK中编写、编译、下载用户代码" class="headerlink" title="3. 在MDK中编写、编译、下载用户代码"></a>3. 在MDK中编写、编译、下载用户代码</h1><h2 id="重定向printf-函数"><a href="#重定向printf-函数" class="headerlink" title="重定向printf( )函数"></a>重定向printf( )函数</h2><p>参考：<a href="http://www.mculover666.cn/posts/2251182441/">【STM32Cube_09】重定向printf函数到串口输出的多种方法</a>。</p>
<h2 id="转发GPS模块的数据"><a href="#转发GPS模块的数据" class="headerlink" title="转发GPS模块的数据"></a>转发GPS模块的数据</h2><p>GPS 使能后不断的接收信号定位，并输出数据，但是 GPS 模块与 USART3 连接，无法直接查看输出的数据，何谈解析，所以先将 USART3 接收到的数据使用 USART1 发送，在电脑上使用串口助手查看，如果对于USART的中断接收方式还不明白，可以查看这篇文章：<a href="http://www.mculover666.cn/posts/1803605667/">【STM32Cube_07】使用USART发送和接收数据（中断模式）</a>。</p>
<p>首先在 <code>main.c</code> 中实现 USART3 接收中断的回调函数：</p>
<pre class=" language-c"><code class="language-c"><span class="token comment" spellcheck="true">/* USER CODE BEGIN 4 */</span>
<span class="token comment" spellcheck="true">/* 中断回调函数 */</span>
<span class="token keyword">void</span> <span class="token function">HAL_UART_RxCpltCallback</span><span class="token punctuation">(</span>UART_HandleTypeDef <span class="token operator">*</span>huart<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">static</span> uint8_t ch<span class="token punctuation">;</span>
    <span class="token comment" spellcheck="true">/* 判断是哪个串口触发的中断 */</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>huart <span class="token operator">-></span>Instance <span class="token operator">==</span> USART3<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token comment" spellcheck="true">//将接收到的数据发送</span>
        <span class="token function">HAL_UART_Transmit</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>huart1<span class="token punctuation">,</span> <span class="token operator">&amp;</span>ch<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0Xffff</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token comment" spellcheck="true">//重新使能串口接收中断</span>
        <span class="token function">HAL_UART_Receive_IT</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>huart3<span class="token punctuation">,</span> <span class="token operator">&amp;</span>ch<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token comment" spellcheck="true">/* USER CODE END 4 */</span></code></pre>
<p>然后修改<code>main</code>函数如下：</p>
<pre class=" language-c"><code class="language-c"><span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token keyword">void</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token function">HAL_Init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token function">SystemClock_Config</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment" spellcheck="true">/* Initialize all configured peripherals */</span>
    <span class="token function">MX_GPIO_Init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">MX_USART1_UART_Init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">MX_USART3_UART_Init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment" spellcheck="true">/* USER CODE BEGIN 2 */</span>

    <span class="token comment" spellcheck="true">/* 使能USART3接收中断 */</span>
    <span class="token function">HAL_UART_Receive_IT</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>huart3<span class="token punctuation">,</span> <span class="token punctuation">(</span>uint8_t<span class="token operator">*</span><span class="token punctuation">)</span>gps_uart<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment" spellcheck="true">/* 使能GPS模块 */</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"L80-R GPS Module test...\r\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">HAL_GPIO_WritePin</span><span class="token punctuation">(</span>GPS_EN_GPIO_Port<span class="token punctuation">,</span>GPS_EN_Pin<span class="token punctuation">,</span> GPIO_PIN_RESET<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"GPE Enable ok.\r\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment" spellcheck="true">/* USER CODE END 2 */</span>

  <span class="token comment" spellcheck="true">/* Infinite loop */</span>
  <span class="token comment" spellcheck="true">/* USER CODE BEGIN WHILE */</span>
  <span class="token keyword">while</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span>
  <span class="token punctuation">{</span>
    <span class="token comment" spellcheck="true">/* USER CODE END WHILE */</span>

    <span class="token comment" spellcheck="true">/* USER CODE BEGIN 3 */</span>
  <span class="token punctuation">}</span>
  <span class="token comment" spellcheck="true">/* USER CODE END 3 */</span>
<span class="token punctuation">}</span></code></pre>
<p>编译下载，可以在串口助手上看到输出的数据：</p>
<p>刚上电时蓝色的LED灯保持常亮状态，表示未定位成功，数据如下：</p>
<p><img src="http://mculover666.cn/blog/20191031/4amfHyTh318C.png?imageslim" alt=""></p>
<p>定位成功后蓝色的LED开始闪烁，数据如下：</p>
<p><img src="http://mculover666.cn/blog/20191031/1TkQ75Is66J0.png?imageslim" alt=""></p>
<h2 id="解析GPS的数据"><a href="#解析GPS的数据" class="headerlink" title="解析GPS的数据"></a>解析GPS的数据</h2><p>将GPS数据转发取消，删除USART3添加的中断函数：</p>
<p><img src="http://mculover666.cn/blog/20191101/vh0Dfo3ks0il.png?imageslim" alt=""></p>
<p>接下来开辟一块缓冲区，来存放接收的GPS数据，并且定义GPS数据结构体，用来存放解析GPS数据得到的经纬度信息：</p>
<pre class=" language-c"><code class="language-c"><span class="token comment" spellcheck="true">/* Private variables ---------------------------------------------------------*/</span>
<span class="token comment" spellcheck="true">/* USER CODE BEGIN PV */</span>
<span class="token comment" spellcheck="true">/***************************************************\
*GPS NMEA-0183协议重要参数结构体定义
*卫星信息
\***************************************************/</span>
__packed <span class="token keyword">typedef</span> <span class="token keyword">struct</span>
<span class="token punctuation">{</span>
    uint32_t latitude_bd<span class="token punctuation">;</span>                    <span class="token comment" spellcheck="true">//纬度   分扩大100000倍，实际要除以100000</span>
    uint8_t nshemi_bd<span class="token punctuation">;</span>                        <span class="token comment" spellcheck="true">//北纬/南纬,N:北纬;S:南纬    </span>
    uint32_t longitude_bd<span class="token punctuation">;</span>              <span class="token comment" spellcheck="true">//经度 分扩大100000倍,实际要除以100000</span>
    uint8_t ewhemi_bd<span class="token punctuation">;</span>                        <span class="token comment" spellcheck="true">//东经/西经,E:东经;W:西经</span>
<span class="token punctuation">}</span>gps_msg<span class="token punctuation">;</span>

<span class="token comment" spellcheck="true">/* E53_ST1传感器数据类型定义 ------------------------------------------------------------*/</span>
<span class="token keyword">typedef</span> <span class="token keyword">struct</span>
<span class="token punctuation">{</span>
        <span class="token keyword">float</span>    Longitude<span class="token punctuation">;</span>                <span class="token comment" spellcheck="true">//经度</span>
        <span class="token keyword">float</span>    Latitude<span class="token punctuation">;</span>        <span class="token comment" spellcheck="true">//纬度</span>
<span class="token punctuation">}</span> E53_ST1_Data_TypeDef<span class="token punctuation">;</span>

gps_msg              gpsmsg<span class="token punctuation">;</span>
<span class="token keyword">static</span> <span class="token keyword">unsigned</span> <span class="token keyword">char</span> gps_uart<span class="token punctuation">[</span><span class="token number">1000</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
E53_ST1_Data_TypeDef E53_ST1_Data<span class="token punctuation">;</span>

<span class="token comment" spellcheck="true">/* USER CODE END PV */</span>
</code></pre>
<p>然后编写解析GPS数据的函数，先要在开头加上头文件支持：</p>
<pre class=" language-c"><code class="language-c"><span class="token comment" spellcheck="true">/* Private includes ----------------------------------------------------------*/</span>
<span class="token comment" spellcheck="true">/* USER CODE BEGIN Includes */</span>
<span class="token macro property">#<span class="token directive keyword">include</span> <span class="token string">&lt;stdio.h></span></span>
<span class="token macro property">#<span class="token directive keyword">include</span> <span class="token string">&lt;string.h></span></span>

<span class="token comment" spellcheck="true">/* USER CODE END Includes */</span></code></pre>
<p>开始编写解析GPS数据所使用的函数：</p>
<pre class=" language-c"><code class="language-c"><span class="token comment" spellcheck="true">/* USER CODE BEGIN 4 */</span>

<span class="token comment" spellcheck="true">/***************************************************\
* 函数名称: NMEA_Comma_Pos
*    函数功能：从buf里面得到第cx个逗号所在的位置
*    输入值：
*    返回值：0~0xFE，代表逗号所在位置的便宜
*                     0xFF，代表不存在第cx个逗号
\***************************************************/</span>

uint8_t <span class="token function">NMEA_Comma_Pos</span><span class="token punctuation">(</span>uint8_t <span class="token operator">*</span>buf<span class="token punctuation">,</span>uint8_t cx<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    uint8_t <span class="token operator">*</span>p <span class="token operator">=</span> buf<span class="token punctuation">;</span>
    <span class="token keyword">while</span><span class="token punctuation">(</span>cx<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token operator">*</span>buf<span class="token operator">==</span><span class="token string">'*'</span><span class="token operator">||</span><span class="token operator">*</span>buf<span class="token operator">&lt;</span><span class="token string">' '</span><span class="token operator">||</span><span class="token operator">*</span>buf<span class="token operator">></span><span class="token string">'z'</span><span class="token punctuation">)</span><span class="token keyword">return</span> <span class="token number">0xFF</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token operator">*</span>buf<span class="token operator">==</span><span class="token string">','</span><span class="token punctuation">)</span>cx<span class="token operator">--</span><span class="token punctuation">;</span>
        buf<span class="token operator">++</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">return</span> buf<span class="token operator">-</span>p<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment" spellcheck="true">/***************************************************\
* 函数名称: NMEA_Pow
*    函数功能：返回m的n次方值
*    输入值：底数m和指数n
*    返回值：m^n
\***************************************************/</span>
uint32_t <span class="token function">NMEA_Pow</span><span class="token punctuation">(</span>uint8_t m<span class="token punctuation">,</span>uint8_t n<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    uint32_t result <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>
    <span class="token keyword">while</span><span class="token punctuation">(</span>n<span class="token operator">--</span><span class="token punctuation">)</span>result <span class="token operator">*</span><span class="token operator">=</span> m<span class="token punctuation">;</span>
    <span class="token keyword">return</span> result<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment" spellcheck="true">/***************************************************\
* 函数名称: NMEA_Str2num
*    函数功能：str数字转换为（int）数字，以','或者'*'结束
*    输入值：buf，数字存储区
*                     dx，小数点位数，返回给调用函数
*    返回值：转换后的数值
\***************************************************/</span>
<span class="token keyword">int</span> <span class="token function">NMEA_Str2num</span><span class="token punctuation">(</span>uint8_t <span class="token operator">*</span>buf<span class="token punctuation">,</span>uint8_t<span class="token operator">*</span>dx<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    uint8_t <span class="token operator">*</span>p <span class="token operator">=</span> buf<span class="token punctuation">;</span>
    uint32_t ires <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span>fres <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
    uint8_t ilen <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span>flen <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span>i<span class="token punctuation">;</span>
    uint8_t mask <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> res<span class="token punctuation">;</span>
    <span class="token keyword">while</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token operator">*</span>p<span class="token operator">==</span><span class="token string">'-'</span><span class="token punctuation">)</span><span class="token punctuation">{</span>mask <span class="token operator">|</span><span class="token operator">=</span> <span class="token number">0x02</span><span class="token punctuation">;</span>p<span class="token operator">++</span><span class="token punctuation">;</span><span class="token punctuation">}</span><span class="token comment" spellcheck="true">//说明有负数</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token operator">*</span>p<span class="token operator">==</span><span class="token string">','</span><span class="token operator">||</span><span class="token operator">*</span>p<span class="token operator">==</span><span class="token string">'*'</span><span class="token punctuation">)</span><span class="token keyword">break</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">//遇到结束符</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token operator">*</span>p<span class="token operator">==</span><span class="token string">'.'</span><span class="token punctuation">)</span><span class="token punctuation">{</span>mask <span class="token operator">|</span><span class="token operator">=</span> <span class="token number">0x01</span><span class="token punctuation">;</span>p<span class="token operator">++</span><span class="token punctuation">;</span><span class="token punctuation">}</span><span class="token comment" spellcheck="true">//遇到小数点</span>
        <span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token operator">*</span>p<span class="token operator">></span><span class="token string">'9'</span><span class="token operator">||</span><span class="token punctuation">(</span><span class="token operator">*</span>p<span class="token operator">&lt;</span><span class="token string">'0'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token comment" spellcheck="true">//数字不在0和9之内，说明有非法字符</span>
        <span class="token punctuation">{</span>
            ilen <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
            flen <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>mask<span class="token operator">&amp;</span><span class="token number">0x01</span><span class="token punctuation">)</span>flen<span class="token operator">++</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">//小数点的位数</span>
        <span class="token keyword">else</span> ilen<span class="token operator">++</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">//str长度加一</span>
        p<span class="token operator">++</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">//下一个字符</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>mask<span class="token operator">&amp;</span><span class="token number">0x02</span><span class="token punctuation">)</span>buf<span class="token operator">++</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">//移到下一位，除去负号</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>i<span class="token operator">&lt;</span>ilen<span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span><span class="token comment" spellcheck="true">//得到整数部分数据</span>
    <span class="token punctuation">{</span>
        ires <span class="token operator">+</span><span class="token operator">=</span> <span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span>ilen<span class="token number">-1</span><span class="token operator">-</span>i<span class="token punctuation">)</span><span class="token operator">*</span><span class="token punctuation">(</span>buf<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token operator">-</span><span class="token string">'0'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>flen<span class="token operator">></span><span class="token number">5</span><span class="token punctuation">)</span>flen<span class="token operator">=</span><span class="token number">5</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">//最多取五位小数</span>
    <span class="token operator">*</span>dx <span class="token operator">=</span> flen<span class="token punctuation">;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>i<span class="token operator">&lt;</span>flen<span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span><span class="token comment" spellcheck="true">//得到小数部分数据</span>
    <span class="token punctuation">{</span>
        fres <span class="token operator">+</span><span class="token operator">=</span><span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span>flen<span class="token number">-1</span><span class="token operator">-</span>i<span class="token punctuation">)</span><span class="token operator">*</span><span class="token punctuation">(</span>buf<span class="token punctuation">[</span>ilen<span class="token operator">+</span><span class="token number">1</span><span class="token operator">+</span>i<span class="token punctuation">]</span><span class="token operator">-</span><span class="token string">'0'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    res <span class="token operator">=</span> ires<span class="token operator">*</span><span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span>flen<span class="token punctuation">)</span><span class="token operator">+</span>fres<span class="token punctuation">;</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>mask<span class="token operator">&amp;</span><span class="token number">0x02</span><span class="token punctuation">)</span>res <span class="token operator">=</span> <span class="token operator">-</span>res<span class="token punctuation">;</span>
    <span class="token keyword">return</span> res<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment" spellcheck="true">/***************************************************\
* 函数名称: NMEA_BDS_GPRMC_Analysis
*    函数功能：解析GPRMC信息
*    输入值：gpsx,NMEA信息结构体
*                 buf：接收到的GPS数据缓冲区首地址
\***************************************************/</span>
<span class="token keyword">void</span> <span class="token function">NMEA_BDS_GPRMC_Analysis</span><span class="token punctuation">(</span>gps_msg <span class="token operator">*</span>gpsmsg<span class="token punctuation">,</span>uint8_t <span class="token operator">*</span>buf<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    uint8_t <span class="token operator">*</span>p4<span class="token punctuation">,</span>dx<span class="token punctuation">;</span>             
    uint8_t posx<span class="token punctuation">;</span>     
    uint32_t temp<span class="token punctuation">;</span>       
    <span class="token keyword">float</span> rs<span class="token punctuation">;</span>  
    p4<span class="token operator">=</span><span class="token punctuation">(</span>uint8_t<span class="token operator">*</span><span class="token punctuation">)</span><span class="token function">strstr</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span><span class="token punctuation">)</span>buf<span class="token punctuation">,</span><span class="token string">"$GPRMC"</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">//"$GPRMC",经常有&amp;和GPRMC分开的情况,故只判断GPRMC.</span>
    posx<span class="token operator">=</span><span class="token function">NMEA_Comma_Pos</span><span class="token punctuation">(</span>p4<span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                                <span class="token comment" spellcheck="true">//得到纬度</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>posx<span class="token operator">!=</span><span class="token number">0XFF</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        temp<span class="token operator">=</span><span class="token function">NMEA_Str2num</span><span class="token punctuation">(</span>p4<span class="token operator">+</span>posx<span class="token punctuation">,</span><span class="token operator">&amp;</span>dx<span class="token punctuation">)</span><span class="token punctuation">;</span>              
        gpsmsg<span class="token operator">-></span>latitude_bd<span class="token operator">=</span>temp<span class="token operator">/</span><span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span>dx<span class="token operator">+</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    <span class="token comment" spellcheck="true">//得到°</span>
        rs<span class="token operator">=</span>temp<span class="token operator">%</span><span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span>dx<span class="token operator">+</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                <span class="token comment" spellcheck="true">//得到'         </span>
        gpsmsg<span class="token operator">-></span>latitude_bd<span class="token operator">=</span>gpsmsg<span class="token operator">-></span>latitude_bd<span class="token operator">*</span><span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token operator">+</span><span class="token punctuation">(</span>rs<span class="token operator">*</span><span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token operator">-</span>dx<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token operator">/</span><span class="token number">60</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">//转换为° </span>
    <span class="token punctuation">}</span>
    posx<span class="token operator">=</span><span class="token function">NMEA_Comma_Pos</span><span class="token punctuation">(</span>p4<span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                                <span class="token comment" spellcheck="true">//南纬还是北纬 </span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>posx<span class="token operator">!=</span><span class="token number">0XFF</span><span class="token punctuation">)</span>gpsmsg<span class="token operator">-></span>nshemi_bd<span class="token operator">=</span><span class="token operator">*</span><span class="token punctuation">(</span>p4<span class="token operator">+</span>posx<span class="token punctuation">)</span><span class="token punctuation">;</span>                     
     posx<span class="token operator">=</span><span class="token function">NMEA_Comma_Pos</span><span class="token punctuation">(</span>p4<span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                                <span class="token comment" spellcheck="true">//得到经度</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>posx<span class="token operator">!=</span><span class="token number">0XFF</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>                                                  
        temp<span class="token operator">=</span><span class="token function">NMEA_Str2num</span><span class="token punctuation">(</span>p4<span class="token operator">+</span>posx<span class="token punctuation">,</span><span class="token operator">&amp;</span>dx<span class="token punctuation">)</span><span class="token punctuation">;</span>              
        gpsmsg<span class="token operator">-></span>longitude_bd<span class="token operator">=</span>temp<span class="token operator">/</span><span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span>dx<span class="token operator">+</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    <span class="token comment" spellcheck="true">//得到°</span>
        rs<span class="token operator">=</span>temp<span class="token operator">%</span><span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span>dx<span class="token operator">+</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                <span class="token comment" spellcheck="true">//得到'         </span>
        gpsmsg<span class="token operator">-></span>longitude_bd<span class="token operator">=</span>gpsmsg<span class="token operator">-></span>longitude_bd<span class="token operator">*</span><span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token operator">+</span><span class="token punctuation">(</span>rs<span class="token operator">*</span><span class="token function">NMEA_Pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token operator">-</span>dx<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token operator">/</span><span class="token number">60</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">//转换为° </span>
    <span class="token punctuation">}</span>
    posx<span class="token operator">=</span><span class="token function">NMEA_Comma_Pos</span><span class="token punctuation">(</span>p4<span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                                <span class="token comment" spellcheck="true">//东经还是西经</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>posx<span class="token operator">!=</span><span class="token number">0XFF</span><span class="token punctuation">)</span>gpsmsg<span class="token operator">-></span>ewhemi_bd<span class="token operator">=</span><span class="token operator">*</span><span class="token punctuation">(</span>p4<span class="token operator">+</span>posx<span class="token punctuation">)</span><span class="token punctuation">;</span>          
<span class="token punctuation">}</span>
<span class="token comment" spellcheck="true">/* USER CODE END 4 */</span></code></pre>
<p>最后编写使用中断方式接收数据到缓冲区，然后调用GPS数据解析函数的函数：</p>
<pre class=" language-c"><code class="language-c"><span class="token keyword">void</span> <span class="token function">E53_ST1_Read_Data</span><span class="token punctuation">(</span><span class="token keyword">void</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>    
  <span class="token comment" spellcheck="true">/* 使用中断方式接收一次数据 */</span>
    <span class="token function">HAL_UART_Receive_IT</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>huart3<span class="token punctuation">,</span>gps_uart<span class="token punctuation">,</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment" spellcheck="true">/* 分析缓冲区的字符串，解析GPS数据 */</span>
    <span class="token function">NMEA_BDS_GPRMC_Analysis</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>gpsmsg<span class="token punctuation">,</span><span class="token punctuation">(</span>uint8_t<span class="token operator">*</span><span class="token punctuation">)</span>gps_uart<span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment" spellcheck="true">/* 将解析到的经纬度数据存放到结构体中，便于其他函数使用 */</span>    
    E53_ST1_Data<span class="token punctuation">.</span>Longitude<span class="token operator">=</span><span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span>gpsmsg<span class="token punctuation">.</span>longitude_bd<span class="token operator">/</span><span class="token number">100000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    
    E53_ST1_Data<span class="token punctuation">.</span>Latitude<span class="token operator">=</span><span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span>gpsmsg<span class="token punctuation">.</span>latitude_bd<span class="token operator">/</span><span class="token number">100000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    
<span class="token punctuation">}</span></code></pre>
<p>当然，别忘了在 <code>main</code> 函数之前声明这些函数：</p>
<pre class=" language-c"><code class="language-c"><span class="token comment" spellcheck="true">/* Private user code ---------------------------------------------------------*/</span>
<span class="token comment" spellcheck="true">/* USER CODE BEGIN 0 */</span>
uint8_t <span class="token function">NMEA_Comma_Pos</span><span class="token punctuation">(</span>uint8_t <span class="token operator">*</span>buf<span class="token punctuation">,</span>uint8_t cx<span class="token punctuation">)</span><span class="token punctuation">;</span>
uint32_t <span class="token function">NMEA_Pow</span><span class="token punctuation">(</span>uint8_t m<span class="token punctuation">,</span>uint8_t n<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">int</span> <span class="token function">NMEA_Str2num</span><span class="token punctuation">(</span>uint8_t <span class="token operator">*</span>buf<span class="token punctuation">,</span>uint8_t<span class="token operator">*</span>dx<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">void</span> <span class="token function">NMEA_BDS_GPRMC_Analysis</span><span class="token punctuation">(</span>gps_msg <span class="token operator">*</span>gpsmsg<span class="token punctuation">,</span>uint8_t <span class="token operator">*</span>buf<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">void</span> <span class="token function">E53_ST1_Read_Data</span><span class="token punctuation">(</span><span class="token keyword">void</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">/* USER CODE END 0 */</span></code></pre>
<p>大功告成，在main函数中调用：</p>
<pre class=" language-c"><code class="language-c"><span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token keyword">void</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
  <span class="token function">HAL_Init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token function">SystemClock_Config</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment" spellcheck="true">/* Initialize all configured peripherals */</span>
  <span class="token function">MX_GPIO_Init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token function">MX_USART1_UART_Init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token function">MX_USART3_UART_Init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment" spellcheck="true">/* USER CODE BEGIN 2 */</span>

  <span class="token function">HAL_UART_Receive_IT</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>huart3<span class="token punctuation">,</span> <span class="token punctuation">(</span>uint8_t<span class="token operator">*</span><span class="token punctuation">)</span>gps_uart<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"L80-R GPS Module test...\r\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment" spellcheck="true">/* 使能GPS模块 */</span>
  <span class="token function">HAL_GPIO_WritePin</span><span class="token punctuation">(</span>GPS_EN_GPIO_Port<span class="token punctuation">,</span>GPS_EN_Pin<span class="token punctuation">,</span> GPIO_PIN_RESET<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"GPE Enable ok.\r\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment" spellcheck="true">/* USER CODE END 2 */</span>

  <span class="token comment" spellcheck="true">/* Infinite loop */</span>
  <span class="token comment" spellcheck="true">/* USER CODE BEGIN WHILE */</span>
  <span class="token keyword">while</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span>
  <span class="token punctuation">{</span>
    <span class="token comment" spellcheck="true">/* USER CODE END WHILE */</span>

    <span class="token comment" spellcheck="true">/* USER CODE BEGIN 3 */</span>
    <span class="token function">E53_ST1_Read_Data</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"Longitude: %f, Latitude: %f.\r\n"</span><span class="token punctuation">,</span> E53_ST1_Data<span class="token punctuation">.</span>Longitude<span class="token punctuation">,</span> E53_ST1_Data<span class="token punctuation">.</span>Latitude<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">HAL_Delay</span><span class="token punctuation">(</span><span class="token number">2000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
  <span class="token comment" spellcheck="true">/* USER CODE END 3 */</span>
<span class="token punctuation">}</span></code></pre>
<h2 id="实验现象"><a href="#实验现象" class="headerlink" title="实验现象"></a>实验现象</h2><p>编译下载后，<strong>尽量将小熊派开发板放在窗户边</strong>，等待定位成功，串口输出数据如下：</p>
<p><img src="http://mculover666.cn/blog/20191101/ere3mnVix0io.png?imageslim" alt=""></p>
<p>定位成功后，定位数据如下：</p>
<p><img src="http://mculover666.cn/blog/20191101/PdwjPdmndKB8.png?imageslim" alt=""></p>
<h2 id="查看定位"><a href="#查看定位" class="headerlink" title="查看定位"></a>查看定位</h2><p>有了GPS定位数据之后，可以在地图上查看具体的位置，也可以上传到华为云IoT平台查看，这里我使用 GPS经纬度查询工具进行查看：</p>
<blockquote>
<p>工具链接：<a href="http://www.gpsspg.com/maps.htm" target="_blank" rel="noopener">http://www.gpsspg.com/maps.htm</a></p>
</blockquote>
<p><img src="http://mculover666.cn/blog/20191101/ut7W41Mz90sV.png?imageslim" alt=""></p>
<p>至此，我们已经学会<strong>如何接收GPS数据并解析出经纬度</strong>。</p>
<p><strong><font color="#FF0000">更多精彩文章及资源，请关注我的微信公众号：『mculover666』。</font></strong></p>
<p><img src="http://mculover666.cn/image/20190814/NQqt1eRxrl1K.png?imageslim" alt=""></p>

            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="http://www.mculover666.cn" rel="external nofollow noreferrer">Mculover666</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="http://www.mculover666.cn/posts/3463670498/">http://www.mculover666.cn/posts/3463670498/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="http://www.mculover666.cn" target="_blank">Mculover666</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/STM32CubeMX/">
                                    <span class="chip bg-color">STM32CubeMX</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">

<div id="article-share">
    
    
    <div class="social-share" data-sites="qq,qzone,wechat,weibo,douban" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
                <style>
    #reward {
        margin: 40px 0;
        text-align: center;
    }

    #reward .reward-link {
        font-size: 1.4rem;
        line-height: 38px;
    }

    #reward .btn-floating:hover {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    #rewardModal {
        width: 320px;
        height: 350px;
    }

    #rewardModal .reward-title {
        margin: 15px auto;
        padding-bottom: 5px;
    }

    #rewardModal .modal-content {
        padding: 10px;
    }

    #rewardModal .close {
        position: absolute;
        right: 15px;
        top: 15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 1.3rem;
        line-height: 20px;
        cursor: pointer;
    }

    #rewardModal .close:hover {
        color: #ef5350;
        transform: scale(1.3);
        -moz-transform:scale(1.3);
        -webkit-transform:scale(1.3);
        -o-transform:scale(1.3);
    }

    #rewardModal .reward-tabs {
        margin: 0 auto;
        width: 210px;
    }

    .reward-tabs .tabs {
        height: 38px;
        margin: 10px auto;
        padding-left: 0;
    }

    .reward-content ul {
        padding-left: 0 !important;
    }

    .reward-tabs .tabs .tab {
        height: 38px;
        line-height: 38px;
    }

    .reward-tabs .tab a {
        color: #fff;
        background-color: #ccc;
    }

    .reward-tabs .tab a:hover {
        background-color: #ccc;
        color: #fff;
    }

    .reward-tabs .wechat-tab .active {
        color: #fff !important;
        background-color: #22AB38 !important;
    }

    .reward-tabs .alipay-tab .active {
        color: #fff !important;
        background-color: #019FE8 !important;
    }

    .reward-tabs .reward-img {
        width: 210px;
        height: 210px;
    }
</style>

<div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="/medias/reward/alipay.png" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="/medias/reward/we-chat.png" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>
            
        </div>
    </div>

    

    

    

    
    <div class="livere-card card" data-aos="fade-up">
    <!-- 来必力City版安装代码 -->
    <div id="lv-container" class="card-content" data-id="city" data-uid="MTAyMC80Njg0OS8yMzM1MA">
        <script type="text/javascript">
            (function (d, s) {
                let j, e = d.getElementsByTagName(s)[0];
                if (typeof LivereTower === 'function') {
                    return;
                }

                j = d.createElement(s);
                j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
                j.async = true;

                e.parentNode.insertBefore(j, e);
            })(document, 'script');
        </script>
        <noscript>为正常使用来必力评论功能请激活JavaScript。</noscript>
    </div>
    <!-- City版安装代码已完成 -->
</div>
    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/posts/2291178417/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/23.jpg" class="responsive-img" alt="Win10沙盒开启方法">
                        
                        <span class="card-title">Win10沙盒开启方法</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            拥有一个秒启动的Win10环境
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2019-11-30
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/%E5%B7%A5%E5%85%B7%E6%8E%A8%E8%8D%90/" class="post-category">
                                    工具推荐
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/%E5%B7%A5%E5%85%B7%E6%8E%A8%E8%8D%90/">
                        <span class="chip bg-color">工具推荐</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/posts/2214138023/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/23.jpg" class="responsive-img" alt="STM32CubeMX-22 | 在SD卡上移植FATFS文件系统">
                        
                        <span class="card-title">STM32CubeMX-22 | 在SD卡上移植FATFS文件系统</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            本篇详细的记录了如何使用STM32CubeMX移植FATFS文件系统到SD卡上。


1. 准备工作硬件准备
开发板首先需要准备一个开发板，这里我准备的是STM32L4的开发板（BearPi）：



Micro SD卡小熊派开发板板载 M
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2019-08-12
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/STM32CubeMX/" class="post-category">
                                    STM32CubeMX
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/STM32CubeMX/">
                        <span class="chip bg-color">STM32CubeMX</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>


<!-- 代码块折行 -->

<style type="text/css">
code[class*="language-"], pre[class*="language-"] { white-space: pre !important; }
</style>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h1, h2, h3, h4, h5, h6'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h1, h2, h3, h4, h5, h6').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>



    <footer class="page-footer bg-color">
    
    <div class="container row center-align" style="margin-bottom: 15px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            <span id="year">2016</span>
            <a href="http://www.mculover666.cn" target="_blank">Mculover666</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
            &nbsp;<i class="fas fa-chart-area"></i>&nbsp;站点总字数:&nbsp;<span
                class="white-color">70.7k</span>&nbsp;字
            
            
            
            
            
            
            <span id="busuanzi_container_site_pv">
                |&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;<span id="busuanzi_value_site_pv"
                    class="white-color"></span>&nbsp;次
            </span>
            
            
            <span id="busuanzi_container_site_uv">
                |&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;<span id="busuanzi_value_site_uv"
                    class="white-color"></span>&nbsp;人
            </span>
            
            <br>
            
            <span id="sitetime">载入运行时间...</span>
            <script>
                function siteTime() {
                    var seconds = 1000;
                    var minutes = seconds * 60;
                    var hours = minutes * 60;
                    var days = hours * 24;
                    var years = days * 365;
                    var today = new Date();
                    var startYear = "2016";
                    var startMonth = "08";
                    var startDate = "28";
                    var startHour = "0";
                    var startMinute = "0";
                    var startSecond = "0";
                    var todayYear = today.getFullYear();
                    var todayMonth = today.getMonth() + 1;
                    var todayDate = today.getDate();
                    var todayHour = today.getHours();
                    var todayMinute = today.getMinutes();
                    var todaySecond = today.getSeconds();
                    var t1 = Date.UTC(startYear, startMonth, startDate, startHour, startMinute, startSecond);
                    var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond);
                    var diff = t2 - t1;
                    var diffYears = Math.floor(diff / years);
                    var diffDays = Math.floor((diff / days) - diffYears * 365);
                    var diffHours = Math.floor((diff - (diffYears * 365 + diffDays) * days) / hours);
                    var diffMinutes = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours) /
                        minutes);
                    var diffSeconds = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours -
                        diffMinutes * minutes) / seconds);
                    if (startYear == todayYear) {
                        document.getElementById("year").innerHTML = todayYear;
                        document.getElementById("sitetime").innerHTML = "本站已安全运行 " + diffDays + " 天 " + diffHours +
                            " 小时 " + diffMinutes + " 分钟 " + diffSeconds + " 秒";
                    } else {
                        document.getElementById("year").innerHTML = startYear + " - " + todayYear;
                        document.getElementById("sitetime").innerHTML = "本站已安全运行 " + diffYears + " 年 " + diffDays +
                            " 天 " + diffHours + " 小时 " + diffMinutes + " 分钟 " + diffSeconds + " 秒";
                    }
                }
                setInterval(siteTime, 1000);
            </script>
            
            <br>
            
            <span id="icp"><img src="/medias/icp.png" style="vertical-align: text-bottom;" />
                <a href="http://www.beian.miit.gov.cn" target="_blank">陇ICP备19002222号</a>
            </span>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/Mculover666" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:mculover666@foxmail.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=2412828003" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 2412828003" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>





    <a href="https://www.zhihu.com/people/wang-shi-wei-67-38/activities" class="tooltipped" target="_blank" data-tooltip="关注我的知乎: https://www.zhihu.com/people/wang-shi-wei-67-38/activities" data-position="top" data-delay="50">
        <i class="fab fa-zhihu1">知</i>
    </a>



    <a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script src="/js/search.js"></script>
<script type="text/javascript">
$(function () {
    searchFunc("/" + "search.xml", 'searchInput', 'searchResult');
});
</script>
    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    <!-- Global site tag (gtag.js) - Google Analytics -->


    <!-- Baidu Analytics -->

<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?6e1efa0988723a1db6356535db2ae6bd";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    

    

    
    <script type="text/javascript" src="/libs/background/ribbon-dynamic.js" async="async"></script>
    
    
    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    

</body>

</html>
